#include "KeyboardListener.h"
#include <QKeyEvent>

KeyboardListener::KeyboardListener(QObject *mw) :
    QThread()
{
    mw->installEventFilter(this);
}


// Forwards keystrokes to Keyboard handler.
bool KeyboardListener::eventFilter(QObject *object, QEvent *event)
 {
     if (event->type() == QEvent::KeyPress){
         QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
         emit signalKeyStroke(keyEvent->key());
         return false;
     }
     return false;
 }
